package com.hlcl.huaji.ctrl.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.elcl.adapter.AbViewHolder;
import com.elcl.adapter.BaseLVAdapter;
import com.elcl.support.userage.domain.BaseSimpleItem;
import com.hlcl.huaji.R;

import java.util.List;

/**
 * Created by lichunlin on 2018/5/23.
 * 个人中心-订单类型
 */

public class MineAdapter extends BaseLVAdapter<BaseSimpleItem> {

    public MineAdapter(List<BaseSimpleItem> list, int idLayout) {
        super(list, idLayout);
    }

    @Override
    public View getItemView(int position, View convertView, ViewGroup parent) {
        ImageView img_mine_head = (ImageView) AbViewHolder.getView(convertView, R.id.img_mine_head);
        TextView tv_mine_title = (TextView) AbViewHolder.getView(convertView, R.id.tv_mine_title);
        TextView tv_content = (TextView) AbViewHolder.getView(convertView, R.id.tv_content);

        BaseSimpleItem baseSimpleItem = list.get(position);
        if (null != baseSimpleItem) {
            img_mine_head.setBackgroundResource(baseSimpleItem.getImg_recourse());
            tv_mine_title.setText(baseSimpleItem.getContent());
            if (position == 0 || position == 3){
                tv_content.setText(baseSimpleItem.getRemark() + "");
            }else{
                tv_content.setText("");
            }
        }
        return convertView;
    }
}
